package com.xzg.erp.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xzg.erp.common.BaseEntity;

import java.time.LocalDate;

import com.xzg.erp.common.valid.SelectValid;
import com.xzg.erp.common.valid.UpdateValid;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author qwc
 * @since 2025-02-04
 */
@Getter
@Setter
@ToString
@TableName("sys_user")
public class SysUser extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 用户名（唯一）
     */
    @NotBlank(message = "请填写用户名，长度在4-15之间",groups = {SelectValid.class, UpdateValid.class})
    @Length(min = 4, max = 15,message = "用户名长度在4-15之间",groups = {SelectValid.class, UpdateValid.class})
    @TableField("username")
    private String username;

    /**
     * 密码
     */
    @NotBlank(message = "请填写密码，长度在6-20之间",groups = {SelectValid.class, UpdateValid.class})
    @Length(min = 6, max = 20,message = "密码长度在6-20之间",groups = {SelectValid.class, UpdateValid.class})
    @TableField("password")
    private String password;

    /**
     * 手机号码
     */
    @NotBlank(message = "请填写联系号码",groups = {UpdateValid.class})
    @TableField("phone")
    private String phone;

    /**
     * 真实姓名
     */
    @NotBlank(message = "请填写姓名",groups = {UpdateValid.class})
    @TableField("real_name")
    private String realName;

    /**
     * 出生日期
     */
    @TableField("birth_date")
    private LocalDate birthDate;
}
